package website.haicheng.system.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import website.haicheng.api.entity.SysLogs;
import website.haicheng.core.base.Resp;
import website.haicheng.system.service.ILogsService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 582895699@qq.com
 * @since 2021-02-09
 */
@Api(tags = "日志相关")
@RestController
@RequestMapping("/logs")
public class LogsController {

    @Autowired
    private ILogsService logsService;

    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功"), @ApiResponse(code = 500, message = "失败")})
    @ApiOperation(value = "保存日志")
    @PostMapping(value = "/saveAccessLog")
    public Resp saveAccessLog(@RequestBody SysLogs logs) {
        logsService.insertAccessLog(logs);
        return Resp.ok();
    }
}
